package com.hzlx;

import com.alibaba.fastjson.JSON;
import com.hzlx.dto.OrderPlaceEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.kafka.annotation.KafkaListener;

@SpringBootApplication
@EnableDiscoveryClient
@Slf4j
public class NotificationServiceApp
{
    public static void main( String[] args )
    {
        SpringApplication.run(NotificationServiceApp.class,args);
    }
    @KafkaListener(topics = "notTopic")
    public void handler(OrderPlaceEvent event){
        log.info("收到消息：{}，{}",event.getOrderNumber(), JSON.toJSONString(event));
    }
}
